Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/jwt iat type #53

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix/jwt iat type #53

wants to merge 2 commits into from

Conversation

ga1az
Copy link

@ga1az ga1az commented Sep 12, 2024

Type iat inconsistency

export interface JWTPayloadSpec {
	iss?: string
	sub?: string
	aud?: string | string[]
	jti?: string
	nbf?: number
	exp?: number
	iat?: number
}

Schema

t.Object({
        iss: t.Optional(t.String()),
        sub: t.Optional(t.String()),
        aud: t.Optional(
	        t.Union([t.String(), t.Array(t.String())])
        ),
        jti: t.Optional(t.String()),
        nbf: t.Optional(t.Union([t.String(), t.Number()])),
        exp: t.Optional(t.Union([t.String(), t.Number()])),
        // change t.Optional(t.String()) -> t.Optional(t.Union([t.String(), t.Number()]))
        iat: t.Optional(t.Union([t.String(), t.Number()]))
})

fix #52

@ga1az
Copy link
Author

ga1az commented Sep 18, 2024

@SaltyAom

@catFurr
Copy link

catFurr commented Oct 9, 2024

is there any reason for Union instead of just Number in your commit?
apart from backwards-compatibility for existing projects.

@ga1az
Copy link
Author

ga1az commented Oct 9, 2024

Because of the retrocompatibility and because the exp field is also a number and the union is also made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iat Type inconsistency
2 participants